package org.jeecg.modules.classes.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.classes.entity.Classes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 班次表
 * @Author: jeecg-boot
 * @Date:   2025-01-21
 * @Version: V1.0
 */
public interface ClassesMapper extends BaseMapper<Classes> {

    @Select("SELECT c.classes_type, c.start_time, c.end_time " +
            "FROM classes c LEFT JOIN scheduling s ON c.id = s.classes_id " +
            "WHERE s.admit_guid = #{admitGuid} " +
            "AND s.date <= CURDATE() " +  // 新增日期限制
            "ORDER BY s.create_time DESC " +
            "LIMIT 1")
    Classes getLastClasses(String admitGuid);

}
